package cn.zwx.common.canal.listener;

import cn.zwx.common.canal.event.AlterAbstractCanalEvent;
import com.alibaba.fastjson.JSON;
import com.alibaba.otter.canal.protocol.CanalEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 *  只监听修改表名称事件
 * @author:zhangwenxue
 */
@Component
public class AlterCanalListener  extends AbstractCanalListener<AlterAbstractCanalEvent>{

    private final Logger logger = LoggerFactory.getLogger(DeleteCanalListener.class);

    @Override
    protected void doChange(String database, String tableName, CanalEntry.RowData rowData,String instanceName,String topic ) {
        logger.info("监听到修改字段事件:数据库名称{},表名称:{},实例:{},topic:{}",database,tableName,instanceName,topic);
        System.out.println(JSON.toJSONString(rowData));
    }
}
